home *** CD-ROM | disk | FTP | other *** search
- { AsciiTable, Calendar }
-
- uses Txt;
-
- { ─────────────── AsciiTable ─────────────── }
- procedure Ascii(X,Y:integer); { 35x19 }
- var A,B,K:integer;
- St:string[3];
- begin
- TextWindow1(X,Y,35,19,$3E,$3F,1,' ASCII Table ');
- for A:=0 to 15 do for B:=0 to 15 do
- PrintText(X+2*B+2,Y+A+2,$30,Chr(16*A+B));
- A:=0; B:=0;
- repeat
- PrintText(X+2,Y+1,$3F,Chr(16*A+B));
- Str(16*A+B:3,St); PrintText(X+30,Y+1,$3F,St);
- PrintText(X+2*B+1,Y+A+2,$1F,' '+Chr(16*A+B)+' ');
- K:=Key;
- PrintText(X+2*B+1,Y+A+2,$30,' '+Chr(16*A+B)+' ');
- case K of
- $4B00:Dec(B); $4D00:Inc(B); { Left, Right }
- $4800:Dec(A); $5000:Inc(A); { Up, Down }
- $4900:Dec(A,4); $5100:Inc(A,4); { PgUp, PgDn }
- $4700:begin A:=0; B:=0; end; { Home }
- $4F00:begin A:=15; B:=15; end; { End }
- end;
- if A<0 then A:=15; if A>15 then A:=0;
- if B<0 then B:=15; if B>15 then B:=0;
- until K=$011B;
- end;
- { ─────────────── Calendar ─────────────── }
- procedure Calendar(X,Y:integer); { 40x10 }
- const
- MonthName:array[1..12] of string[9]=(
- 'January ','February ','March ','April ','May ','June ',
- 'July ','August ','September','October ','November ','December ');
- DayName:array[1..7] of string[3]=(
- 'Sun','Mon','Tue','Wed','Thu','Fri','Sat');
- var Month,Year,Day,Today,I,A,B,K:integer;
- St:string[4];
- begin
- TextWindow1(X,Y,40,10,$3E,$3F,1,' Calendar ');
- for I:=1 to 7 do PrintText(X+5*I-2,Y+2,$30,DayName[I]);
- Val(Copy(GetDate,1,4),Year,I);
- Val(Copy(GetDate,6,2),Month,I);
- Val(Copy(GetDate,9,2),Today,I);
- repeat
- Day:=WhichDay(Year,Month,1);
- PrintText(X+3,Y+1,$3F,MonthName[Month]);
- Str(Year:4,St); PrintText(X+32,Y+1,$3F,St);
- TextBar(X+1,Y+3,38,5,$31,' ');
- if ((Year and 3=0) and (Year mod 100<>0)) or (Year mod 400=0)
- then MonthDays[2]:=29 else MonthDays[2]:=28;
- for I:=1 to MonthDays[Month] do begin
- Str(I:2,St); A:=(I-1+Day) mod 7; B:=(I-1+Day) div 7;
- if I=Today then PrintText(5*A+X+2,B+Y+3,$1F,' '+St+' ')
- else if A>0 then PrintText(5*A+X+3,B+Y+3,$31,St)
- else PrintText(5*A+X+3,B+Y+3,$34,St);
- end;
- K:=Key;
- case K of
- $4B00:Dec(Month); $4D00:Inc(Month); { Left, Right }
- $4800:Dec(Year); $5000:Inc(Year); { Up, Down }
- $4900:Dec(Year,50); $5100:Inc(Year,50); { PgUp, PgDn }
- $4700:Year:=1; $4F00:Year:=9999; { Home, End }
- end;
- if Month<1 then begin Month:=12; Dec(Year); end;
- if Month>12 then begin Month:=1; Inc(Year); end;
- if Year<1 then Year:=1; if Year>9999 then Year:=9999;
- until K=$011B;
- end;
-
- begin
- TextBar(1,1,80,25,$1B,' ');
- Ascii(30,3);
- Calendar(10,6);
- end.
-